Imports System.Collections

Partial Class pages_languages_usercontrols_UCLanguage : Inherits UserControl

#Region "Members"
    Private m_language As CLanguage
#End Region

#Region "Interface"
    Public Sub Display(ByVal [language] As CLanguage, ByVal parentIndex As Integer, ByVal childIndex As Integer)
        If Parent.Controls.Count Mod 2 = 0 Then row.Attributes.Add("class", "alt_row")

        m_language = [language]

        With m_language
            If childIndex = Integer.MinValue Then
                litNumber.Text = CStr(parentIndex + 1) & "."
            Else
                litChild.Text = CStr(parentIndex + 1) & ChrW(97 + childIndex) & ". "
            End If

            lnkLanguageName.Text = CStr(IIf(.LanguageName.Length = 0, "...", .LanguageName))
            lnkLanguageName.NavigateUrl = CSitemap.LanguageEdit(.LanguageId)
            lnkProducts.Text = CUtilities.CountSummary(.Products, "product", "none")
            'lnkProducts.NavigateUrl = CSitemap.Products(
            litLanguageNative.Text = .LanguageNative
        End With
    End Sub
#End Region

#Region "Event Handlers"
    Private Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnDelete.Click
        m_language.Delete()
        Refresh()
    End Sub
#End Region

#Region "Private"
    Private Sub Refresh()
        'CCache.ClearCache()

        'If False Then 'Request.RawUrl.ToLower.Contains("myparent.aspx") Then
        '    'Special case: Parent entity owns the list
        '    Response.Redirect(CSitemap.MyParentEdit(m_language.LanguageParentId, MyParent.ETab.languages, m_pageIndex)
        'Else
        '    'Normal case: Search page owns the list
            Response.Redirect(Request.RawUrl) 'includes paging info
        'End If 
    End Sub
#End Region

End Class
